﻿<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /> 
    <meta http-equiv="Pragma" content="no-cache" /> 
    <meta http-equiv="Expires" content="0" />
    <title>NM工作台</title>
    <script type="text/javascript" src="./js/jquery-2.2.4.min.js"></script>
    <link rel='Shortcut Icon' type='image/x-icon' href='./img/windows.ico'>
    <script src="//cdn.bootcss.com/eruda/1.4.2/eruda.min.js"></script>
    <script>eruda.init();</script>
    <style>
        html, body {
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;
            border: 0;
        }

        .topPart {
            width: 100%;
        }

        .bottomPart {
            width: 100%;
            height: 100%;
        }

        #iframe {
            height: 100%;
            width: 100%;
            border: 0;
        }
    </style>
</head>
<body>
<div class="topPart">
        <!--<input value="ppp" />
        <input value="哦破婆婆" />  <input value="ppp"/>
        <input value="哦破婆婆"/>  <input value="ppp"/>
        <input value="哦破婆婆"/>  <input value="ppp"/>-->
    </div>
<div class="bottomPart">
    <iframe id="iframe" src=""></iframe>
</div>

<script type="text/javascript">
    $(function() {

        //获取地址栏参数
        var getUrlParam = function (name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]);
            return null;
        };

        var reSize = function() {
            $('.bottomPart').css("height", $('html').height() - $('.topPart').height() - 5 + "px");
        };

        var loginBi = function (className, methodName, paramArray, callback, sync) {
            $.ajax('http://rpt.erp-km.cn:9002/smartbi/vision/RMIServlet', {
                type: 'POST',
                async: !sync,
                data: {
                    'className': className,
                    'methodName': methodName,
                    'params': JSON.stringify(paramArray)
                },
                dataType: 'json',
                success: callback,
                failure: callback,
                error: callback
            });
        };

        var realUrl = getUrlParam("realUrl");
        console.log(window.location.href);
        console.log("realUrl:" + realUrl);

        if (realUrl.indexOf("smartbi") > -1) {
            loginBi('UserService', 'login', ['bi_test', '123456'], function (data) {
                if (data && data.result) {
                    $('#iframe').attr('src', realUrl + "&" + Math.random());
                    console.log("登入BI报表成功");
                }
                else {
                    console.log("登入BI报表失败");
                }
            }, true);
        } else {
            $('#iframe').attr('src', realUrl + "&" + Math.random());
        }

        //reSize();

    });
</script>
</body>
</html>